<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      h2 {
        text-align: center;
      }
      table {
        width: 500px;
        height: 80px;
        margin: 0 auto;
        /* 合并边框 */
        border-collapse: collapse;
      }
      table,
      th,
      td {
        border: 1px solid #000;
        /* 文字居中 */
        text-align: center;
      }
    </style>
  </head>
  <body>
    <h2>订单确认</h2>

    <script>
      let price = +prompt("请输入商品价格"); //隐式转换为数字
      let num = +prompt("请输入商品数量");
      let address = prompt("请输入收货地址");
      let total = price * num;
      // 页面打印
      document.write(`
        <table>
          <tr>
            <th>商品</th>
            <th>价格</th>
            <th>数量</th>
            <th>小计</th>
            <th>地址</th>
          </tr>
          <tr>
            <td>小米10</td>
            <td>${price}</td>
            <td>${num}</td>
            <td>${total}</td>
            <td>${address}</td>
          </tr>
        </table>
      `);
    </script>
  </body>
</html>
